// const MongoClient = require('mongodb').MongoClient;
const {MongoClient, ObjectID} = require('mongodb');


MongoClient.connect('mongodb://localhost:27017/TodaApp', (err, db) => {
    if (err) {
        return console.log('Unable to connect the mongodb server')
    }

    console.log('Connected to MongDB server');

    db.db('TodoApp').collection('Todos').findOneAndUpdate({
            _id: new ObjectID('5a38bf521a71aad3e03b0957')
        }, {
            $set: {completed: true}
        }, {
            returnOriginal: false
        }
    ).then((res) => {
        console.log(res);
    })


    // db.close();

})

